# Maintainer: Luca Weiss <luca@z3ntu.xyz>
pkgname=zeitgeist
pkgver=1.0.2
pkgrel=2
pkgdesc="Activity logging framework"
arch="all"
url="https://zeitgeist.freedesktop.org/"
license="LGPL-2.1-or-later"
depends_dev="sqlite-dev gobject-introspection-dev xapian-core-dev telepathy-glib-dev
	gtk+3.0-dev json-glib-dev"
makedepends="$depends_dev autoconf automake gettext-dev libtool py3-rdflib vala git
	raptor2"
source="https://gitlab.freedesktop.org/zeitgeist/zeitgeist/-/archive/v$pkgver/zeitgeist-v$pkgver.tar.gz
	gettext_0.20.patch"
subpackages="
	$pkgname-dev
	$pkgname-doc
	lib$pkgname:libs
	py3-$pkgname:py3:noarch
	$pkgname-bash-completion
	"
builddir="$srcdir/$pkgname-v$pkgver"
options="!check" # Needs D-Bus server, see https://gitlab.freedesktop.org/zeitgeist/zeitgeist/issues/4

prepare() {
	default_prepare

	NOCONFIGURE=1 ./autogen.sh
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--libexecdir=/usr/lib \
		--enable-fts

	sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool

	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	# systemd
	rm -rf "$pkgdir"/usr/lib/systemd
}

py3() {
	pkgdesc="Python3 bindings for $pkgname"
	depends="python3 lib$pkgname=$pkgver-r$pkgrel"

	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/python* "$subpkgdir"/usr/lib
}

sha512sums="077c2b751b5cb96efc5da6e47336456e1dec4238b1d252218c6da137049dd0c61d518b6079e632fbbfe5edeced0c89e922c826aed1f0811fd6a29ad89abd53ae  zeitgeist-v1.0.2.tar.gz
db47a77efe7ba5cc3f71a9a2d438359c8c9a8dcd2e016726f7776d373177c863e848e4ed4525df66237c79fbf94e3cad3e2844ac685a90e663680cb71e44ff5d  gettext_0.20.patch"
